package com.ocom.webapi.controller;

import com.ocom.common.constant.WebApiServiceUrl;
import com.ocom.common.request.web.DelPayChannelRequest;
import com.ocom.common.request.web.EditPayChannelRequest;
import com.ocom.common.request.web.GetPayChannelRequest;
import com.ocom.common.request.web.SavePayChannelRequest;
import com.ocom.common.resp.Result;
import com.ocom.webapi.feign.PayConfigClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@PreAuthorize("@pms.hasRole('ROLE_WEB')" )
public class PayChannelController {

	@Autowired
	private PayConfigClientService payConfigClientService;

	@PostMapping(WebApiServiceUrl.URL_getPageChannel)
	public Result getPageChannel(@RequestBody GetPayChannelRequest request){
		return payConfigClientService.getPageChannel(request);
	}

	@PostMapping(WebApiServiceUrl.URL_addPageChannel)
	public Result addPageChannel(@RequestBody SavePayChannelRequest request){
		return payConfigClientService.addPageChannel(request);
	}

	@PostMapping(WebApiServiceUrl.URL_editPageChannel)
	public Result editPageChannel(@RequestBody EditPayChannelRequest request){
		return payConfigClientService.editPageChannel(request);
	}

	@PostMapping(WebApiServiceUrl.URL_delPageChannel)
	public Result WebApiServiceUrl(@RequestBody DelPayChannelRequest request){
		return payConfigClientService.delPageChannel(request);
	}


}
